package ai.people.netmon.framework.domain.gang.construction.entity;

import ai.people.netmon.framework.domain.gang.construction.request.RelationLibConfigSaveOrUpdateRequest;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 关系库-类型
 * </p>
 *
 * @author zhenglin
 * @since 2022-07-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(schema = "webservice")
@NoArgsConstructor
public class RelationLibConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private Long id;
    /**
     * 扩线关系点value
     */
    private String expListValue;
    /**
     * 类型value
     */
    private String expTypeValue;
    /**
     * 规则ID
     */
    private Long relationRuleId;

    /**
     * 配置的规则
     */
    private String rule;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 是否禁用 1是 0否
     */
    private Integer lockFlag;


    public RelationLibConfig(RelationLibConfigSaveOrUpdateRequest request) {
        this.expListValue = request.getExpListValue();
        this.expTypeValue = request.getExpTypeValue();
        this.relationRuleId = request.getRelationRuleId();
        this.rule = request.buildRuleStr();
    }

}
